<template>
  <view class="wrap">
    <u-form :model="model" :rules="rules" ref="uForm">
      <u-form-item label-width="200" label="学号">
        <u-input v-model="model.stu_no" type="text" disabled></u-input>
      </u-form-item>
      <u-form-item label-width="200" label="专业">
        <u-input v-model="model.major_name" type="text" disabled></u-input>
      </u-form-item>
      <u-form-item label-width="200" label="班级">
        <u-input v-model="model.classes_name" type="text" disabled></u-input>
      </u-form-item>
      <u-form-item label-width="200" label="宿舍">
        <u-input v-model="model.dorm_name" type="text" disabled></u-input>
      </u-form-item>

      <u-form-item label-width="200" label="生源地">
        <u-input :border="border" v-model="model.stu_home" type="text"></u-input>
      </u-form-item>
      <u-form-item label-width="200" label="密码">
        <u-input :border="border" v-model="model.password" type="text"></u-input>
      </u-form-item>
      <u-form-item label-width="200" label="身份证号码">
        <u-input :border="border" v-model="model.id_card" type="text"></u-input>
      </u-form-item>
      <u-form-item label-width="200" label="姓名">
        <u-input :border="border" v-model="model.stu_name" type="text"></u-input>
      </u-form-item>

    </u-form>
    <u-button type="primary" @click="submit">修改</u-button>
    <view>
        <u-toast ref="uToast" />
    </view>
  </view>
</template>

<script>
export default {
  data() {
    let that = this;
    return {
      model: {
        check_date: '',
        vehicle: '',
        vehicle_no: '',
      },
      rules: {},
      border: true,
      check: false,
      selectStatus: 'close',
    };
  },
  onLoad() {

  },
  created() {
    this.detail()
  },
  computed: {},
  onReady() {
    this.$refs.uForm.setRules(this.rules);
  },
  methods: {
    detail() {
      this.$u.get('/student/detail', {
        id: 2
      }).then(res => {
        console.log(res)
        this.model = res;
      })
    },
    submit() {
      console.log(12)
      let that = this
      this.$u.put('/student/edit', this.model).then(res => {
        that.$refs.uToast.show({
          title: '操作成功',
        })
      });
    },
  }
};
</script>

<style scoped lang="scss">
.wrap {
  padding: 30 rpx;
}

.agreement {
  display: flex;
  align-items: center;
  margin: 40 rpx 0;

  .agreement-text {
    padding-left: 8 rpx;
    color: $u-tips-color;
  }
}
</style>
